public class Person {

    //封装

    //属性
    private String name;
    private int age;
    private String gender;

    public void setName(String name) {
        this.name = name;//就近原则
    }

    public String getName(){
        return  name;
    }

    public  void  setAge(int age){
        if(age>=18&&age<=50){
            this.age=age;
        }else {
            System.out.println("非法参数");
        }
    }

    public  int getAge(){
        return  age;
    }

    public  void  setGender(String gender){
        this.gender=gender;
    }

    public String getGender(){
        return gender;
    }

    //行为
    public  void  sleep(){
        System.out.println("超级飞侠好想睡觉啊啊啊啊");
    }
    public  void  eat(){
        System.out.println("超级飞侠好想吃饭啊啊啊啊");
    }

}
